3.115 \(\int \frac{A+B \tan (e+f x)+C \tan ^2(e+f x)}{(a+b \tan (e+f x))^2 \sqrt{c+d \tan (e+f x)}} \, dx\)

Optimal. Leaf size=327 \[ -\frac{\left (A b^2-a (b B-a C)\right ) \sqrt{c+d \tan (e+f x)}}{f \left (a^2+b^2\right ) (b c-a d) (a+b \tan (e+f x))}-\frac{\left (-a^2 b^2 (5 A d+2 B c-3 C d)+3 a^3 b B d+a^4 (-C) d+a b^3 (4 A c-B d-4 c C)+b^4 (2 B c-A d)\right ) \tanh ^{-1}\left (\frac{\sqrt{b} \sqrt{c+d \tan (e+f x)}}{\sqrt{b c-a d}}\right )}{\sqrt{b} f \left (a^2+b^2\right )^2 (b c-a d)^{3/2}}-\frac{(i A+B-i C) \tanh ^{-1}\left (\frac{\sqrt{c+d \tan (e+f x)}}{\sqrt{c-i d}}\right )}{f (a-i b)^2 \sqrt{c-i d}}-\frac{(B-i (A-C)) \tanh ^{-1}\left (\frac{\sqrt{c+d \tan (e+f x)}}{\sqrt{c+i d}}\right )}{f (a+i b)^2 \sqrt{c+i d}} \]

[Out]

-(((I*A + B - I*C)*ArcTanh[Sqrt[c + d*Tan[e + f*x]]/Sqrt[c - I*d]])/((a - I*b)^2*Sqrt[c - I*d]*f)) - ((B - I*(
A - C))*ArcTanh[Sqrt[c + d*Tan[e + f*x]]/Sqrt[c + I*d]])/((a + I*b)^2*Sqrt[c + I*d]*f) - ((3*a^3*b*B*d - a^4*C
*d + b^4*(2*B*c - A*d) + a*b^3*(4*A*c - 4*c*C - B*d) - a^2*b^2*(2*B*c + 5*A*d - 3*C*d))*ArcTanh[(Sqrt[b]*Sqrt[
c + d*Tan[e + f*x]])/Sqrt[b*c - a*d]])/(Sqrt[b]*(a^2 + b^2)^2*(b*c - a*d)^(3/2)*f) - ((A*b^2 - a*(b*B - a*C))*
Sqrt[c + d*Tan[e + f*x]])/((a^2 + b^2)*(b*c - a*d)*f*(a + b*Tan[e + f*x]))

________________________________________________________________________________________

Rubi [A]  time = 1.37937, antiderivative size = 327, normalized size of antiderivative = 1., number of steps used = 12, number of rules used = 7, integrand size = 47, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.149, Rules used = {3649, 3653, 3539, 3537, 63, 208, 3634} \[ -\frac{\left (A b^2-a (b B-a C)\right ) \sqrt{c+d \tan (e+f x)}}{f \left (a^2+b^2\right ) (b c-a d) (a+b \tan (e+f x))}-\frac{\left (-a^2 b^2 (5 A d+2 B c-3 C d)+3 a^3 b B d+a^4 (-C) d+a b^3 (4 A c-B d-4 c C)+b^4 (2 B c-A d)\right ) \tanh ^{-1}\left (\frac{\sqrt{b} \sqrt{c+d \tan (e+f x)}}{\sqrt{b c-a d}}\right )}{\sqrt{b} f \left (a^2+b^2\right )^2 (b c-a d)^{3/2}}-\frac{(i A+B-i C) \tanh ^{-1}\left (\frac{\sqrt{c+d \tan (e+f x)}}{\sqrt{c-i d}}\right )}{f (a-i b)^2 \sqrt{c-i d}}-\frac{(B-i (A-C)) \tanh ^{-1}\left (\frac{\sqrt{c+d \tan (e+f x)}}{\sqrt{c+i d}}\right )}{f (a+i b)^2 \sqrt{c+i d}} \]

Antiderivative was successfully verified.

[In]

Int[(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2)/((a + b*Tan[e + f*x])^2*Sqrt[c + d*Tan[e + f*x]]),x]

[Out]

-(((I*A + B - I*C)*ArcTanh[Sqrt[c + d*Tan[e + f*x]]/Sqrt[c - I*d]])/((a - I*b)^2*Sqrt[c - I*d]*f)) - ((B - I*(
A - C))*ArcTanh[Sqrt[c + d*Tan[e + f*x]]/Sqrt[c + I*d]])/((a + I*b)^2*Sqrt[c + I*d]*f) - ((3*a^3*b*B*d - a^4*C
*d + b^4*(2*B*c - A*d) + a*b^3*(4*A*c - 4*c*C - B*d) - a^2*b^2*(2*B*c + 5*A*d - 3*C*d))*ArcTanh[(Sqrt[b]*Sqrt[
c + d*Tan[e + f*x]])/Sqrt[b*c - a*d]])/(Sqrt[b]*(a^2 + b^2)^2*(b*c - a*d)^(3/2)*f) - ((A*b^2 - a*(b*B - a*C))*
Sqrt[c + d*Tan[e + f*x]])/((a^2 + b^2)*(b*c - a*d)*f*(a + b*Tan[e + f*x]))

Rule 3649

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_)*((A_.) + (B_.)*t
an[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[((A*b^2 - a*(b*B - a*C))*(a + b*T
an[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^(n + 1))/(f*(m + 1)*(b*c - a*d)*(a^2 + b^2)), x] + Dist[1/((m + 1)*(
b*c - a*d)*(a^2 + b^2)), Int[(a + b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^n*Simp[A*(a*(b*c - a*d)*(m + 1)
 - b^2*d*(m + n + 2)) + (b*B - a*C)*(b*c*(m + 1) + a*d*(n + 1)) - (m + 1)*(b*c - a*d)*(A*b - a*B - b*C)*Tan[e
+ f*x] - d*(A*b^2 - a*(b*B - a*C))*(m + n + 2)*Tan[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C,
 n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && LtQ[m, -1] &&  !(ILtQ[n, -1] && ( !I
ntegerQ[m] || (EqQ[c, 0] && NeQ[a, 0])))

Rule 3653

Int[(((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (
f_.)*(x_)]^2))/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[1/(a^2 + b^2), Int[(c + d*Tan[e + f*
x])^n*Simp[b*B + a*(A - C) + (a*B - b*(A - C))*Tan[e + f*x], x], x], x] + Dist[(A*b^2 - a*b*B + a^2*C)/(a^2 +
b^2), Int[((c + d*Tan[e + f*x])^n*(1 + Tan[e + f*x]^2))/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e,
f, A, B, C, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] &&  !GtQ[n, 0] &&  !LeQ[n, -
1]

Rule 3539

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[(c
 + I*d)/2, Int[(a + b*Tan[e + f*x])^m*(1 - I*Tan[e + f*x]), x], x] + Dist[(c - I*d)/2, Int[(a + b*Tan[e + f*x]
)^m*(1 + I*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0]
&& NeQ[c^2 + d^2, 0] &&  !IntegerQ[m]

Rule 3537

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[(c*
d)/f, Subst[Int[(a + (b*x)/d)^m/(d^2 + c*x), x], x, d*Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, m}, x] &&
NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && EqQ[c^2 + d^2, 0]

Rule 63

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - (a*d)/b + (d*x^p)/b)^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 208

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-(a/b), 2]*ArcTanh[x/Rt[-(a/b), 2]])/a, x] /; FreeQ[{a,
b}, x] && NegQ[a/b]

Rule 3634

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.)*((A_) + (C_.)*
tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Dist[A/f, Subst[Int[(a + b*x)^m*(c + d*x)^n, x], x, Tan[e + f*x]], x]
 /; FreeQ[{a, b, c, d, e, f, A, C, m, n}, x] && EqQ[A, C]

Rubi steps

\begin{align*} \int \frac{A+B \tan (e+f x)+C \tan ^2(e+f x)}{(a+b \tan (e+f x))^2 \sqrt{c+d \tan (e+f x)}} \, dx &=-\frac{\left (A b^2-a (b B-a C)\right ) \sqrt{c+d \tan (e+f x)}}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x))}-\frac{\int \frac{\frac{1}{2} \left (A b^2 d-2 a A (b c-a d)-2 (b B-a C) \left (b c-\frac{a d}{2}\right )\right )+(A b-a B-b C) (b c-a d) \tan (e+f x)+\frac{1}{2} \left (A b^2-a (b B-a C)\right ) d \tan ^2(e+f x)}{(a+b \tan (e+f x)) \sqrt{c+d \tan (e+f x)}} \, dx}{\left (a^2+b^2\right ) (b c-a d)}\\ &=-\frac{\left (A b^2-a (b B-a C)\right ) \sqrt{c+d \tan (e+f x)}}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x))}-\frac{\int \frac{-\left (2 a b B+a^2 (A-C)-b^2 (A-C)\right ) (b c-a d)-\left (a^2 B-b^2 B-2 a b (A-C)\right ) (b c-a d) \tan (e+f x)}{\sqrt{c+d \tan (e+f x)}} \, dx}{\left (a^2+b^2\right )^2 (b c-a d)}+\frac{\left (3 a^3 b B d-a^4 C d+b^4 (2 B c-A d)+a b^3 (4 A c-4 c C-B d)-a^2 b^2 (2 B c+5 A d-3 C d)\right ) \int \frac{1+\tan ^2(e+f x)}{(a+b \tan (e+f x)) \sqrt{c+d \tan (e+f x)}} \, dx}{2 \left (a^2+b^2\right )^2 (b c-a d)}\\ &=-\frac{\left (A b^2-a (b B-a C)\right ) \sqrt{c+d \tan (e+f x)}}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x))}+\frac{(A-i B-C) \int \frac{1+i \tan (e+f x)}{\sqrt{c+d \tan (e+f x)}} \, dx}{2 (a-i b)^2}+\frac{(A+i B-C) \int \frac{1-i \tan (e+f x)}{\sqrt{c+d \tan (e+f x)}} \, dx}{2 (a+i b)^2}+\frac{\left (3 a^3 b B d-a^4 C d+b^4 (2 B c-A d)+a b^3 (4 A c-4 c C-B d)-a^2 b^2 (2 B c+5 A d-3 C d)\right ) \operatorname{Subst}\left (\int \frac{1}{(a+b x) \sqrt{c+d x}} \, dx,x,\tan (e+f x)\right )}{2 \left (a^2+b^2\right )^2 (b c-a d) f}\\ &=-\frac{\left (A b^2-a (b B-a C)\right ) \sqrt{c+d \tan (e+f x)}}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x))}-\frac{(i (A+i B-C)) \operatorname{Subst}\left (\int \frac{1}{(-1+x) \sqrt{c+i d x}} \, dx,x,-i \tan (e+f x)\right )}{2 (a+i b)^2 f}+\frac{(i A+B-i C) \operatorname{Subst}\left (\int \frac{1}{(-1+x) \sqrt{c-i d x}} \, dx,x,i \tan (e+f x)\right )}{2 (a-i b)^2 f}+\frac{\left (3 a^3 b B d-a^4 C d+b^4 (2 B c-A d)+a b^3 (4 A c-4 c C-B d)-a^2 b^2 (2 B c+5 A d-3 C d)\right ) \operatorname{Subst}\left (\int \frac{1}{a-\frac{b c}{d}+\frac{b x^2}{d}} \, dx,x,\sqrt{c+d \tan (e+f x)}\right )}{\left (a^2+b^2\right )^2 d (b c-a d) f}\\ &=-\frac{\left (3 a^3 b B d-a^4 C d+b^4 (2 B c-A d)+a b^3 (4 A c-4 c C-B d)-a^2 b^2 (2 B c+5 A d-3 C d)\right ) \tanh ^{-1}\left (\frac{\sqrt{b} \sqrt{c+d \tan (e+f x)}}{\sqrt{b c-a d}}\right )}{\sqrt{b} \left (a^2+b^2\right )^2 (b c-a d)^{3/2} f}-\frac{\left (A b^2-a (b B-a C)\right ) \sqrt{c+d \tan (e+f x)}}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x))}-\frac{(A-i B-C) \operatorname{Subst}\left (\int \frac{1}{-1-\frac{i c}{d}+\frac{i x^2}{d}} \, dx,x,\sqrt{c+d \tan (e+f x)}\right )}{(a-i b)^2 d f}-\frac{(A+i B-C) \operatorname{Subst}\left (\int \frac{1}{-1+\frac{i c}{d}-\frac{i x^2}{d}} \, dx,x,\sqrt{c+d \tan (e+f x)}\right )}{(a+i b)^2 d f}\\ &=-\frac{(i A+B-i C) \tanh ^{-1}\left (\frac{\sqrt{c+d \tan (e+f x)}}{\sqrt{c-i d}}\right )}{(a-i b)^2 \sqrt{c-i d} f}-\frac{(B-i (A-C)) \tanh ^{-1}\left (\frac{\sqrt{c+d \tan (e+f x)}}{\sqrt{c+i d}}\right )}{(a+i b)^2 \sqrt{c+i d} f}-\frac{\left (3 a^3 b B d-a^4 C d+b^4 (2 B c-A d)+a b^3 (4 A c-4 c C-B d)-a^2 b^2 (2 B c+5 A d-3 C d)\right ) \tanh ^{-1}\left (\frac{\sqrt{b} \sqrt{c+d \tan (e+f x)}}{\sqrt{b c-a d}}\right )}{\sqrt{b} \left (a^2+b^2\right )^2 (b c-a d)^{3/2} f}-\frac{\left (A b^2-a (b B-a C)\right ) \sqrt{c+d \tan (e+f x)}}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x))}\\ \end{align*}

Mathematica [A]  time = 6.21476, size = 521, normalized size = 1.59 \[ -\frac{\left (A b^2-a (b B-a C)\right ) \sqrt{c+d \tan (e+f x)}}{f \left (a^2+b^2\right ) (b c-a d) (a+b \tan (e+f x))}-\frac{\frac{2 \sqrt{b c-a d} \left (\frac{1}{2} a^2 d \left (A b^2-a (b B-a C)\right )+\frac{1}{2} b^2 \left (-2 a A (b c-a d)-2 (b B-a C) \left (b c-\frac{a d}{2}\right )+A b^2 d\right )-a b (b c-a d) (-a B+A b-b C)\right ) \tanh ^{-1}\left (\frac{\sqrt{b} \sqrt{c+d \tan (e+f x)}}{\sqrt{b c-a d}}\right )}{\sqrt{b} f \left (a^2+b^2\right ) (a d-b c)}+\frac{\frac{i \sqrt{c-i d} \left (-(b c-a d) \left (a^2 (A-C)+2 a b B-b^2 (A-C)\right )+i (b c-a d) \left (a^2 B-2 a b (A-C)-b^2 B\right )\right ) \tanh ^{-1}\left (\frac{\sqrt{c+d \tan (e+f x)}}{\sqrt{c-i d}}\right )}{f (-c+i d)}-\frac{i \sqrt{c+i d} \left (-(b c-a d) \left (a^2 (A-C)+2 a b B-b^2 (A-C)\right )-i (b c-a d) \left (a^2 B-2 a b (A-C)-b^2 B\right )\right ) \tanh ^{-1}\left (\frac{\sqrt{c+d \tan (e+f x)}}{\sqrt{c+i d}}\right )}{f (-c-i d)}}{a^2+b^2}}{\left (a^2+b^2\right ) (b c-a d)} \]

Antiderivative was successfully verified.

[In]

Integrate[(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2)/((a + b*Tan[e + f*x])^2*Sqrt[c + d*Tan[e + f*x]]),x]

[Out]

-((((I*Sqrt[c - I*d]*(I*(a^2*B - b^2*B - 2*a*b*(A - C))*(b*c - a*d) - (2*a*b*B + a^2*(A - C) - b^2*(A - C))*(b
*c - a*d))*ArcTanh[Sqrt[c + d*Tan[e + f*x]]/Sqrt[c - I*d]])/((-c + I*d)*f) - (I*Sqrt[c + I*d]*((-I)*(a^2*B - b
^2*B - 2*a*b*(A - C))*(b*c - a*d) - (2*a*b*B + a^2*(A - C) - b^2*(A - C))*(b*c - a*d))*ArcTanh[Sqrt[c + d*Tan[
e + f*x]]/Sqrt[c + I*d]])/((-c - I*d)*f))/(a^2 + b^2) + (2*Sqrt[b*c - a*d]*((a^2*(A*b^2 - a*(b*B - a*C))*d)/2
- a*b*(A*b - a*B - b*C)*(b*c - a*d) + (b^2*(A*b^2*d - 2*a*A*(b*c - a*d) - 2*(b*B - a*C)*(b*c - (a*d)/2)))/2)*A
rcTanh[(Sqrt[b]*Sqrt[c + d*Tan[e + f*x]])/Sqrt[b*c - a*d]])/(Sqrt[b]*(a^2 + b^2)*(-(b*c) + a*d)*f))/((a^2 + b^
2)*(b*c - a*d))) - ((A*b^2 - a*(b*B - a*C))*Sqrt[c + d*Tan[e + f*x]])/((a^2 + b^2)*(b*c - a*d)*f*(a + b*Tan[e
+ f*x]))

________________________________________________________________________________________

Maple [B]  time = 0.222, size = 20870, normalized size = 63.8 \begin{align*} \text{output too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e))^(1/2)/(a+b*tan(f*x+e))^2,x)

[Out]

result too large to display

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e))^(1/2)/(a+b*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e))^(1/2)/(a+b*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

Timed out

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{A + B \tan{\left (e + f x \right )} + C \tan ^{2}{\left (e + f x \right )}}{\left (a + b \tan{\left (e + f x \right )}\right )^{2} \sqrt{c + d \tan{\left (e + f x \right )}}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e)+C*tan(f*x+e)**2)/(c+d*tan(f*x+e))**(1/2)/(a+b*tan(f*x+e))**2,x)

[Out]

Integral((A + B*tan(e + f*x) + C*tan(e + f*x)**2)/((a + b*tan(e + f*x))**2*sqrt(c + d*tan(e + f*x))), x)

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{C \tan \left (f x + e\right )^{2} + B \tan \left (f x + e\right ) + A}{{\left (b \tan \left (f x + e\right ) + a\right )}^{2} \sqrt{d \tan \left (f x + e\right ) + c}}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e))^(1/2)/(a+b*tan(f*x+e))^2,x, algorithm="giac")

[Out]

integrate((C*tan(f*x + e)^2 + B*tan(f*x + e) + A)/((b*tan(f*x + e) + a)^2*sqrt(d*tan(f*x + e) + c)), x)